import logging
from colorama import init, Fore, Style

init(autoreset=True)

# 配置日志记录器
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)

def example_callback(host_name):
    display_line = "This is an example log message."
    colors = [Fore.BLUE, Fore.GREEN, Fore.YELLOW, Fore.MAGENTA, Fore.CYAN]
    color_index = hash(host_name) % len(colors)
    color = colors[color_index]
    logger.info(f"{color}[{host_name}]{Style.RESET_ALL} | {display_line}")

# 测试调用
example_callback("personal-server-2")
import logging
from colorama import init, Fore, Style

init(autoreset=True)

# 配置日志记录器
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)

def example_callback(host_name):
    display_line = "This is an example log message."
    colors = [Fore.BLUE, Fore.GREEN, Fore.YELLOW, Fore.MAGENTA, Fore.CYAN]
    color_index = hash(host_name) % len(colors)
    color = colors[color_index]
    logger.info(f"{color}[{host_name}]{Style.RESET_ALL} | {display_line}")

# 测试调用
example_callback("personal-server-2")
example_callback("personal-server-1")
example_callback("personal-server-3")